﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class headertop : System.Web.UI.UserControl
{
    protected void Page_PreRender(object sender, EventArgs e)
    {
        if (Session["user"] == null)
        {
            lbldangky.Visible = true;
            lbldangnhap.Visible = true;
            lbllogin.Visible = false;
            authenticated.Visible = false;
        }
        if (Session["user"] != null)
        {
            authenticated.Visible = true;
            lbldangky.Visible = false;
            lbldangnhap.Visible = false;
            lbllogin.Visible = true;
            lbldau.Visible = false;
            string username = Session["name"].ToString();
            lbllogin.Text = "Chào mừng &nbsp;" + "<strong>" + username + "</strong>";

            //lbtdk.Visible = lbldn.Visible = false;
            //lbl_user.Visible = lblthoat.Visible = true;
            //string username = Session["name"].ToString();
            //lbl_user.Text = "Chào mừng &nbsp;" + "<strong>" + username + "</strong>" + "&nbsp;|&nbsp;";
            //authenticated.Visible = true;
        }
    }
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        Session.Remove("user");
        lbldangky.Visible = true;
        lbldangnhap.Visible = true;
        lbldau.Visible = true;
        lbllogin.Visible = false;
        Response.Redirect("index.aspx");
    }
}